package cn.study.luckyapp.activity.command;

import cn.study.luckyapp.assembler.ActivityAssembler;
import cn.study.luckyclient.dto.ActivityUpdateCmd;
import cn.study.luckyclient.dto.data.ActivityVo;
import cn.study.luckydomain.activity.ActivityEntity;
import cn.study.luckydomain.gateway.ActivityGateway;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;

@AllArgsConstructor
@Component
public class ActivityUpdateCmdExe {
    private final ActivityGateway activityGateway;
    public ActivityVo execute(ActivityUpdateCmd cmd){
        ActivityEntity save = activityGateway.save(ActivityAssembler.toUpdateEntity(cmd));
        return ActivityAssembler.toActivityVO(save);
    }
}
